package com.quartz.controller;

import com.quartz.entity.Account;
import com.quartz.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * Created with IntelliJ IDEA.
 * User: lixiao
 * Created Date: 2020/7/31 15:25
 */
@RestController
@RequestMapping(value = "/account")
public class AccountController {

    @Autowired
    AccountService accountService;

    @GetMapping(value = "/{id}")
    public Account find(@PathVariable("id") int id){
        return accountService.findAccount(id);
    }

    @GetMapping(value = "/add")
    public String addAccount(){
        Account account=new Account();
        account.setId(UUID.randomUUID().toString());
        account.setMoney(1);
        account.setName("nihao");
        return accountService.addAccount(account);
    }
}